<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>合格证信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <style>
        .moreGps {
            width: 398px;
            -moz-border-radius: 4px;
            -webkit-border-radius: 4px;
            -ms-border-radius: 4px;
            -khtml-border-radius: 4px;
            border-radius: 4px;
        }
    </style>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <form id="prj_prd_veh_info_form">
            <div class="fieldset1 tabel_col clearFix">
                <div class="fieldBox col_50">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <span>${vehInfo.cstNm}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">合同号</div>
                    <div class="field">
                        <span><a href="javascript:prjDetailBtn(${vehInfo.prjId});">${vehInfo.lsCntNo}</a></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <span><a
                                href="javascript:payDetailBtn(' ' ,${vehInfo.paySchId},${vehInfo.prjPrdId },${vehInfo.prjId});">${vehInfo.paySchNo}</a></span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">租赁物名称</div>
                    <div class="field">
                        <span>${vehInfo.prdNm}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label">租赁物型号</div>
                    <div class="field">
                        <span id="prjPrdMdl">${vehInfo.prjPrdMdl}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">合格证型号</div>
                    <div class="field">
                        <span id="prdMdl">${vehInfo.prdMdl}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">租赁物发动机型号</div>
                    <div class="field">
                        <span id="prjEngMdl">${vehInfo.prjEngMdl}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">合格证发动机型号</div>
                    <div class="field">
                        <span id="engMdl">${vehInfo.engMdl}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">发动机号</div>
                    <div class="field">
                        <span id="engNo">${vehInfo.engNo}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">合格证编号</div>
                    <div class="field">
                        <span id="engNo">${vehInfo.certNo}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label">发证日期</div>
                    <div class="field">
                        <span id="certDt">${vehInfo.certDt}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">车辆制造企业名称</div>
                    <div class="field">
                        <span id="mfrNm">${vehInfo.mfrNm}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">车辆品牌</div>
                    <div class="field">
                        <span id="vehBr">${vehInfo.vehBr}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">车辆名称</div>
                    <div class="field">
                        <span id="vehNm">${vehInfo.vehNm}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">车架号</div>
                    <div class="field">
                        <span id="vin">${vehInfo.vin}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label">车身颜色</div>
                    <div class="field">
                        <span id="carCl">${vehInfo.carCl}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 底盘型号</div>
                    <div class="field">
                        <span id="chsMdl">${vehInfo.chsMdl}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 底盘ID</div>
                    <div class="field">
                        <span id="chsId">${vehInfo.chsId}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 底盘合格证编号</div>
                    <div class="field">
                        <span id="chsCertNo">${vehInfo.chsCertNo}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label">燃料种类</div>
                    <div class="field">
                        <span id="fuelTyp">${vehInfo.fuelTyp}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 排量（ml）</div>
                    <div class="field">
                        <span id="outVol">${vehInfo.outVol}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 功率（kW）</div>
                    <div class="field">
                        <span id="maxKw">${vehInfo.maxKw}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 油耗</div>
                    <div class="field">
                        <span id="oilCns">${vehInfo.oilCns}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 外廓尺寸（mm）</div>
                    <div class="field">
                        <span id="outlineSz">${vehInfo.outlineSz}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 货厢内部尺寸（mm）</div>
                    <div class="field">
                        <span id="cntrSz">${vehInfo.cntrSz}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 钢板弹簧片数（片）</div>
                    <div class="field">
                        <span id="leafSprNum">${vehInfo.leafSprNum}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 轮胎数</div>
                    <div class="field">
                        <span id="whlNum">${vehInfo.whlNum}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 轮胎规格</div>
                    <div class="field">
                        <span id="whlSpec">${vehInfo.whlSpec}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 轮距(前/后)（mm）</div>
                    <div class="field">
                        <span id="thread">${vehInfo.thread}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">轴距（mm）</div>
                    <div class="field">
                        <span id="whlBase">${vehInfo.whlBase}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 轴荷（kg）</div>
                    <div class="field">
                        <span id="axleLoad">${vehInfo.axleLoad}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">轴数</div>
                    <div class="field">
                        <span id="axisNum">${vehInfo.axisNum}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">转向形式</div>
                    <div class="field">
                        <span id="strTyp">${vehInfo.strTyp}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 总质量</div>
                    <div class="field">
                        <span id="totWgt">${vehInfo.totWgt}</span>
                    </div>
                </div>

                <div class="fieldBox col_50">
                    <div class="label"> 整备质量（kg）</div>
                    <div class="field">
                        <span id="curbWgt">${vehInfo.curbWgt}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 额定载质量（kg）</div>
                    <div class="field">
                        <span id="ratedWgt">${vehInfo.ratedWgt}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 载质量利用系数</div>
                    <div class="field">
                        <span id="wgtCoe">${vehInfo.wgtCoe}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 准牵引总质量（kg）</div>
                    <div class="field">
                        <span id="traTotWgt">${vehInfo.traTotWgt}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 半挂车鞍座最大允许总质量（kg）</div>
                    <div class="field">
                        <span id="semiMaxWgt">${vehInfo.semiMaxWgt}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 驾驶室准乘人数（人）</div>
                    <div class="field">
                        <span id="cabSeatQty">${vehInfo.cabSeatQty}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 额定载客（人）</div>
                    <div class="field">
                        <span id="ratedSeatQty">${vehInfo.ratedSeatQty}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">最高设计车速（km/h）</div>
                    <div class="field">
                        <span id="maxSpd">${vehInfo.maxSpd}</span>
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label"> 车辆制造日期</div>
                    <div class="field">
                        <span id="proDt">${vehInfo.proDt}</span>
                    </div>
                </div>
                <div class="fieldBox col_100">
                    <div class="label">排放标准</div>
                    <div class="field">
                        <span id="emiStd">${vehInfo.emiStd}</span>
                    </div>
                </div>
                <div class="fieldBox col_100">
                    <div class="label"> 备注</div>
                    <div class="field">
                        <textarea name="dtlRem" id="dtlRem" rows="4" class="ui-textarea l-textarea" style="width:80%"
                                  value="">${vehInfo.dtlRem }</textarea>
                    </div>
                </div>
                <div class="fieldBox col_50" style="display: none">
                    <div class="field">
                        <input name="vehId" id="vehId" type="text" value="${vehInfo.id }">
                        <input name="dtlId" id="dtlId" type="text" value="${vehInfo.dtlId }">
                    </div>
                </div>

                <%--中交GPS信息--%>
                <div class="fieldBox col_100">
                    <div class="fieldBox col_50">
                        <div class="label">车牌号</div>
                        <div class="field">
                            <span id="vehNo"></span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">GPS在线状态</div>
                        <div class="field">
                            <span id="gpsStatus"></span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">地址</div>
                        <div class="field">
                            <span id="address"></span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">经度</div>
                        <div class="field">
                            <span id="longitude"></span>
                        </div>
                    </div>
                    <div class="fieldBox col_50">
                        <div class="label">纬度</div>
                        <div class="field">
                            <span id="latitude"></span>
                        </div>
                    </div>
                </div>

                <!--GPS卡号 -->
                <div class="fieldBox col_100">
                    <div class="sqPanel_body">
                        <div id="gpsInfoCfgGrid" class="sq-grid"></div>
                    </div>
                </div>

                <%--<div class="fieldBox col_50">
                   <div class="label">GPS卡号1</div>
                   <div class="field">
                    <span id="gpsCardNo">${vehInfo.prjPrdDtl.gpsCardNo}</span>
                   </div>
               </div>

                 <div class="fieldBox col_50">
                   <div class="label">GPS卡号2</div>
                   <div class="field">
                    <span id="gpsCardNo2">${vehInfo.prjPrdDtl.gpsCardNo2}</span>
                   </div>
               </div>
               <div id="btnsBox" class="btnsBox">
               <span id="moreBtn" class="sq-button sq-button-round"
                   onclick="moreGps();" style="display:none">更多GPS卡号
               </span>
           </div>--%>
                <%--<div class="fieldset1 tabel_col clearFix" id="moreGps">
                        <span id="addGps" class="sq-button sq-button-round" onclick="addGps();" >新增GPS卡号</span>
                        <c:forEach items="${moreGpsList}" var="item">
                        <div class="fieldBox col_100">
                            <div class="label" style="width:13.5%;padding-left:2%">
                            GPS卡号</div>
                            <div class="field" style="padding-left:15%;width:58%">
                                    <input type="text" id="gpsCardNoMore" name="gpsCardNoMore"
                                    value="${item.gpsCardNo}" class="moreGps">
                            </div>
                            <span id="deleteButton" class="sq-button-hasicon onlyicon deleteButton" onclick="deleteGps(this);" ><i class="sqBtnIco_7"></i></span>
                        </div>
                        </c:forEach>
                </div>--%>
                <div class="fieldBox col_100">
                    <div class="label">挂靠公司</div>
                    <div class="field">
                        <span id="lnkCompNm">${vehInfo.prjPrdDtl.lnkCompNm}</span>
                    </div>
                </div>
                <%--                       	  <div class="fieldset1 tabel_col tabel_col_s clearFix">
                                          <div class="caption">
                                              <span class="title">上传附件信息 </span>
                                          </div>


                                     <div class="fieldBox col_100" id="fileModify">
                                      <div class="label">资料</div>
                                      <div class="field">
                                          <jsp:include page="../../system/sysUlFilesRec/sysUlFileRecListDetail.jsp" flush="true" >
                                              <jsp:param name="pkId" value="${dtlId}"/>
                                              <jsp:param name="tabNm" value="PRJ_PRD_DTL"/>
                                          </jsp:include>
                                      </div>
                                  </div>

                            </div> --%>
                <div class="fieldBox col_100" id="fileModify">
                    <div class="sqPanel">
                        <div class="sqPanel_head inL">
                            <span>合格证扫描照片信息</span>
                        </div>
                        <table class="table_full tbl_1">
                            <tbody id="imgTable">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">


    var gpsInfoCfgGrid = null;//GPS卡号明细
    var detailFlag = '${detailFlag}';
    var dtlId = '${dtlId}';
    $(function () {
        var ligerForm = liger.get("prj_prd_veh_info_form");
        $("#prj_prd_veh_info_form").ligerForm({
            validate: true
        });
        if (detailFlag == "true") {
            $("#prj_prd_veh_info_add_btn_id").hide();
        }
        if ($("#dtlRem") && $("#dtlRem") != "undefined") {
            $("#dtlRem").setDisabled_ligerTextarea(true);
        }
        $("#addGps").hide();
        $("span[id='deleteButton']").each(function () {
            $(this).hide();
        });
        $("input[id='gpsCardNoMore']").each(function () {
            $(this).attr("readonly", "true");
        });
        setFormatDateValue();
        prjPrdVehImgList();
        getChinaGPSInfo();

        // 加载GPS信息
        gpsInfoCfgGrid = $("#gpsInfoCfgGrid").ligerGrid({
            url: '<%=path%>/prjprddtlgps/prjPrdDtlGps/initGPSInfoList.do?prjDtlId=${dtlId}',
            method: 'get',
            columns: [
                /*{display: 'GPS序号', name: 'serialNo'},*/
                {display: 'GPS卡号', name: 'gpsCardNo'},
                {display: 'GPS平台状态', name: 'gpsStsCdNm'},
                {display: '末次位置', name: 'gpsAddrInfo'},
                {display: '经度', name: 'lng'},
                {display: '纬度', name: 'lat'},
                {display: '末次时间', name: 'lastTm'},
                {display: '距离当前时间(小时)', name: 'fromLastTm'},
                {display: '设备类型', name: 'gpsDeviceType'},
                {display: '领用人工号', name: 'receiveName'},
                {display: '领用人姓名', name: 'receiveRealName'}
            ],
            root: 'rows',
            width: '100%',
            isScroll: false, //是否滚动
            rownumbers: true,  //显示序号
            checkbox: false, //是否显示复选框
            allowUnSelectRow: true,  //是否允许反选行
            alternatingRow: false, //奇偶行效果
            usePager: false// 是否使用分页
        });
    });


    function prjDetailBtn(id) {
        var fromPrjFlag = true;
        var detailFlag = true;
        var _flag = $("#fromPrjFlagId").val();
        if (StringUtils.isNotEmpty(_flag)) {
            if (_flag == 'false') {
                fromPrjFlag = false;
            }
        }
        Add_navTab('tab_project_detail' + id, '项目详情', '<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag=' + fromPrjFlag + '&&id=' + id + '&&detailFlag=' + detailFlag);
    }

    function payDetailBtn(prjPrdDtlId, id, prjPrdId, prjId) {
        if (null == id) {
            id = "";
        }
        if (null == prjPrdDtlId) {
            prjPrdDtlId = "";
        }
        if (null == prjPrdId) {
            prjPrdId = "";
        }
        var editFlag = true;
        Add_navTab('tab_prj_quat_prps' + id, '查看支付表', '<%=path%>/project/prjprdpayschm/toAddPage.do?prjId=' + prjId + '&&id=' + id + '&&prjPrdDtlId=' + prjPrdDtlId + '&&prjPrdId=' + prjPrdId + '&&detailFlag=' + editFlag);
    }

    //设置日期值
    function setFormatDateValue() {
        var certDt = '${vehInfo.certDt}';
        if (certDt) {
            var certDate = DateUtils.formatDate(new Date(certDt), DateUtils.YYYY_MM_DD);
            $("#certDt").text(certDate);//
        }
        var proDt = '${vehInfo.proDt}';
        if (proDt) {
            var proDate = DateUtils.formatDate(new Date(proDt), DateUtils.YYYY_MM_DD);
            $("#proDt").text(proDate);//
        }

    }

    function prjPrdVehImgList() {
        var dtlId = '${dtlId}';
        var params = {};
        params.dtlId = dtlId;
        var url = '<%=path%>/project/prjprdvehinfo/getPrjPrdVehImgList.do';
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: params,
            url: url,
            success: function (msg) {
                if (msg.success == 1) {
                    if (msg.data && msg.data.length > 0) {
                        initImgData(msg.data);
                    }
                }
            }
        });
    }

    function initImgData(data) {
        if (data && data.length > 0) {
            var html = "";
            html += "<tr>";
            for (var i = 0; i < data.length; i++) {
                var file = data[i];
                if ((i + 1) % 4 == 0) {
                    html += "</tr>";
                    html += "<tr>";
                }
                html += "<td>";
                html += "<div class='imgBox'>";
                html += "<img id='imgPath' src='" + file.filePath + "' onclick='scanData(this,event);' href='" + file.filePath + "'>";
                html += "</div>";
                html += "</td>";
            }
            html += "</tr>";
            $("#imgTable").html(html);
        }
    }

    function scanData(img, event) {
        event.preventDefault();
        var href = $(img).attr('src');
        // var href = "http://10.10.36.18/attachments/CCI20170301_0004.JPG";
        if (SQ.regs.img.test(href)) {
            SQ.imgPreview(href);
        } else {
            alert('不是图片');
        }
        ;
    }

    function getChinaGPSInfo() {
        var dtlId = '${dtlId}';
        var params = {};
        params.dtlId = dtlId;
        var url = '<%=path%>/project/prjprdvehinfo/getChinaGPSInfo.do';
        $.ajax({
            type: 'GET',
            dataType: 'json',
            data: params,
            url: url,
            success: function (msg) {
                if (msg.success == 1 && msg.data) {
                    $('#vehNo').html(msg.data.gpsCardNo);
                    $('#gpsStatus').html(msg.data.onlineType);
                    $('#address').html(msg.data.gpsAddrInfo);
                    $('#longitude').html(msg.data.lng);
                    $('#latitude').html(msg.data.lat);
                }
            }
        });
    }
</script>
</body>
</html>